Lab 1 The following program will multiply the number in memory cell 009 (or a) by 8 and leave the result in the accumulator. (Since cell 009 contains 15, the accumulator will contain 120 when the program halts.) assign1part1.sim1 Multiply a by 8, leaving the produce in the accumulator. ASSEMBLY LANUGAGE HIGH LEVEL LANGUAGE 000 1009 start: ld a acc = a; 001 3009 add a acc = acc + a; 002 3009 add a acc = acc + a; 003 3009 add a acc = acc + a; 004 3009 add a acc = acc + a; 005 3009 add a acc = acc + a; 006 3009 add a acc = acc + a; 007 3009 add a acc = acc + a; 008 0000 halt exit(0); 009 0020 a: .word 15 int a = 15; 000 .end start If sim1.c is compiled and then executed, the result is shown below, with the expected number (120) in the accumulator when the halt instruction is executed. grnlntrn:>gcc sim1.c grnlntrn:>./a.out < assign1.sim1 assign1part1.sim1 Multiply "a" by 8, leaving produce in acc ASSEMBLY LANUGAGE HIGH LEVEL LANGUAGE 000 1009 start: ld a acc = a; 001 3009 add a acc = acc + a; 002 3009 add a acc = acc + a; 003 3009 add a acc = acc + a; 004 3009 add a acc = acc + a; 005 3009 add a acc = acc + a; 006 3009 add a acc = acc + a; 007 3009 add a acc = acc + a; 008 0000 halt exit(0); 009 0015 a: .word 15 int a = 15; 000 .end start Starting execution of SIM program at address 000 cnt = 1, ip = 000, inst = 1009, acc = 0000 cnt = 2, ip = 001, inst = 3009, acc = 0015 cnt = 3, ip = 002, inst = 3009, acc = 0030 cnt = 4, ip = 003, inst = 3009, acc = 0045 cnt = 5, ip = 004, inst = 3009, acc = 0060 cnt = 6, ip = 005, inst = 3009, acc = 0075 cnt = 7, ip = 006, inst = 3009, acc = 0090 cnt = 8, ip = 007, inst = 3009, acc = 0105 cnt = 9, ip = 008, inst = 0000, acc = 0120 Processor executed HALT instruction cnt = 9, ip = 009, inst = 0000, acc = 0120 grnlntrn:> 1. The program above executed a total of 9 instructions. Rewrite the program to compute the same result using only 7 instructions. (This requires some thought). Note that you can use additional memory cells for storage. HINT can you multiply "a" by 32 using 11 instructions, but it requires 12 instructions to multiply by 31. Hand in a sheet similar to the output above containing: (a) a listing of your SIM1 machine language program including the assembly language and high level language comments for your program. (b) a copy of the output produced by your program. 2. Use the last digit of your Temple ID number as an index into the following table. 0 41 5 46 1 42 6 47 2 43 7 48 3 44 8 49 4 45 9 50 Write a program to multiply an arbitrary number by "your" number from the table above using the minimum number of instructions. As before, hand in a sheet of paper containing the program listing (including comments) and the program output. 3. What is the minimum number of instructions required to multiply a number by 1000 plus your number. (If the last digit of your temple ID is 3, you should multiply by 1044.) Try to argue that your answer is really the minimum possible. You should hand English text describing your program along with the programs length. No code is required. Hand in your answers on stapled computer printout and make sure each sheet includes your name and Temple ID number. Your answers to parts 1 and 2 should be documented using both assembly language and the high level language. Include all of the output produced by running the program.